#include <QCoreApplication>
#include "classa.h"
#include "classb.h"
#include <qqueue.h>
#define ONE_PRODUCER_ONE_CONSUMER 0
#define ONE_PRODUCER_MULTI_CONSUMER 0
#define MULTI_PRODUCER_ONE_CONSUMER 0
#define MULTI_PRODUCER_MULTI_CONSUMER 1
int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

        QQueue<int> queue;
   # if ONE_PRODUCER_ONE_CONSUMER
    classA  thread1;
    classB thread2;
    thread1.data=1234567;
    thread2.data=9999999;

    thread1.queue=&queue;
    thread2.queue=&queue;
     thread1.start();
    thread2.start();
    #endif

    # if ONE_PRODUCER_MULTI_CONSUMER
     classA  thread1;
     classB thread2;
     classB thread3;
     thread1.queue=&queue;
     thread2.queue=&queue;
     thread3.queue=&queue;
     thread1.data=1234567;
     thread2.data=8888888;
     thread3.data=999999;
      thread1.start();
     thread2.start();
     thread3.start();
     #endif

    # if MULTI_PRODUCER_MULTI_CONSUMER
     classA  thread1;
     classA  thread11;
     classB thread2;

     classB thread3;
     thread1.data=1234567;
     thread11.data=7654321;
     thread2.data=8888888;
     thread3.data=999999;

     thread11.queue=&queue;
     thread1.queue=&queue;
     thread2.queue=&queue;
     thread3.queue=&queue;
      thread1.start();
      thread11.start();
     thread2.start();
     thread3.start();
     #endif

    # if MULTI_PRODUCER_ONE_CONSUMER
     classA  thread1;
     classA  thread11;
     classA  thread111;
     classB thread2;
     thread11.queue=&queue;
     thread11.data=111111;
     thread111.queue=&queue;
     thread111.data=333333;
     thread1.queue=&queue;
     thread1.data=222222;
      thread2.data=9999999;
     thread2.queue=&queue;
      thread1.start();
      thread11.start();
      thread111.start();
     thread2.start();
     #endif


    while(1);

    return a.exec();
}
